package com.yzzrjy.controller.mainservlet.user;

import com.yzzrjy.Service.UserService;
import com.yzzrjy.bean.UserLiveBean;
import com.yzzrjy.util.DruidUtils;
import com.yzzrjy.util.ResponseUtils;
import org.apache.commons.dbutils.QueryRunner;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.sql.SQLException;

//获取用户全信息不需要校核token
@WebServlet(name = "getLiveUserInfoServlet", value = "/getLiveUserInfo")
public class getLiveUserInfoServlet extends HttpServlet {
    private UserService userService = new UserService();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String liveUid = request.getParameter("liveUid");
        String myUid = request.getParameter("myUid");
        if(liveUid == null || myUid == null){
            ResponseUtils.parameterError(response);
            return;
        }
        try {
            UserLiveBean bean = userService.getUserLiveBean(liveUid, myUid);
            if(bean == null){
                ResponseUtils.userNotExist(response);
                return;
            }
            ResponseUtils.success(response, bean);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
